It is difficult to define this word accurately because people use it in different ways. Some definitions include:
Perhaps though the simplest explanation is that grammar is the rules which we have to combine words so they make sense.
There has been much debate on this point. Essentially a prescriptive grammar tells people what to say.
For example, old-fashioned grammars used to say one must never split an infinitive. The problem thought is that millions of people split infinitives everyday in their speech so if the majority of people do it, can it be wrong?
Another problem with prescriptive grammars is that they look at language as a fixed entity. They assume that language does not change. However, language does change and new ways of speaking come into fashion.
More recently, we have what are called descriptive grammars. These don't tell people what to say, they simply describe how people speak.
The ICAL Grammar Guide takes a very pragmatic view. We describe what most people say and what is most useful for learners of English. If a learner splits and infinitive they will still be understood so why complicate matters?
See the main article, Descriptive vs Prescriptive Grammars.