Each grammar rule corresponds to a datatype definition and each alternative in a rule has a corresponding alternative in the datatype definition. Each non-terminal in the grammar corresponds to a data type. Therefore, the writing of data type definitions is equivalent to defining a context-free grammar. Due to the analogy between a set of datatype definitions and a grammar, we will refer to such a set as a grammar. In general, the grammar in the specification should be as specific as possible i.e., generate a minimum number of sentences of a given size.
Good specificity is essential to reduce the amount of combinatorial search during program synthesis.
When the grammar has been chosen, the next step is to choose sample inputs. As a rule of thumb, one may choose all sentences of size n for as sample inputs. One general principle is to try to cover all special cases. The authors of textbooks in mathematics and English for elementary school are masters in the art of pedagogical specification.