Grammars are rule-based descriptions of formal languages. A grammar (at least for JFLAP) specifies substitution rules by which any string in a given language can be generated from a certain input string of terminal and/or nonterminal characters. Each class of grammars corresponds to a particular class of langauges and a particular class of automata that accept it. Here is a listing of grammars and their corresponding languages.
| Grammar | Language | Automata |
| Regular Grammars | Regular Languages | Finite Automata |
| Context-free Grammar | Context-free Language | Push-Down Automata |
| Unrestricted Grammar | Recursively Enumerable Languages | Turing Machine |
Regular grammars are either left-linear or right-linear.
A right-linear grammar is a grammar in which all substitution rules are of the forms:
{A}\rightarrow{xB}
{A}\rightarrow{x}
where \inline {A}, {B} are nonterminal symbols, and \inline {x} is zero or more terminal symbols.
{A}\rightarrow{Bx}
{A}\rightarrow{x}
with \inline {A}, {B}, {x} defined as above.These more powerful grammars are similar to regular grammars except the right-hand side is entirely unconstrained. All substitution rules have the form:
{A}\rightarrow{x}
where \inline {A} is a nonterminal symbol, and \inline {x} is zero or more terminal or nonterminal symbols. Unrestricted grammars are those accepted by Turing machines, and they are unrestricted in the sense that substitution rules can take any form. The only exception is that the left-hand side of the rule cannot be the empty string.