Context-free grammars are a notation for describing languages using variables and productions. They are more powerful than regular expressions but still cannot define all possible languages. A context-free grammar consists of terminals, variables, a start symbol, and productions. Strings in the language are derived by replacing variables according to the productions until a string of just terminals is reached. Leftmost and rightmost derivations restrict replacements to specific variables.