Play with the example on Repl.It!
While Tracery may seem complicated at first, it works on two things: symbols and rules.
Think of symbols as possible outcomes. These can be words, numbers, or phrases. They are simply possible output.
Rules are just that: rules. The rules define how the symbols relate to each other.
Symbols + Rules = Grammar
In Tracery, symbols are given to it through the createGrammar() function. They define what the symbols are and possible values for those symbols to create a grammar.
Then, with the rules and symbols, the grammar is flattened into one possible outcome through filtering the symbols, their possibilities, and the rules.