Context-Free Grammars as a Tool for Describing Polynomial-Time Subclasses of Hard Problems