Grammatical Categories and Their Formal Patterns