Grammar refers to the set of rules and structures that govern the way words are combined to form meaningful sentences in a language. It encompasses the principles of word formation, sentence structure, and the relationships between different parts of speech.