Grammar-dependent software development and grammarware engineering have recently received considerable attention. As a significant cornerstone of grammarware engineering, grammar refactoring is, nevertheless, still weakly understood and practiced. In this paper, we address this issue by introducing pLERO, formal specification language for preserving knowledge of grammar engineers, complementing mARTINICA, the universal approach for automated refactoring of context-free grammars. With respect to other approaches, advantage of mARTINICA lies in refactoring on the basis of user-defined refactoring task, rather than of a fixed objective of the refactoring process. To understand the unified refactoring process, this paper also provides a brief insight into grammar refactoring operators, providing universal refactoring transformations for specific context-free grammars. To preserve knowledge considering refactoring process, we propose formalism based on patterns, seen as well-proven way of knowledge preservation in variety of domains, such as software architectures.