Improve prepare_grammar specs