Compilers are those scary beasts inside your computer that pretend to accept your offerings of code, and then respond violently with a bounty of errors that demonstrate your utter inability to tell a computer what to do, properly.
Alternatively, from page 1 of the Dragon Book
Simply stated, a compiler is a program that can read a program in one language — the source language — and translate it into an equivalent program in another language — the target language;
The actual central processing unit (CPU) of a standard computer only knows about numbers and simple operations that can be done on numbers. However, the application you are using to display this text probably has windows, graphics, buttons, and all sorts of fancy functionality that doesn't appear to have much to do with numbers at all! It doesn't make sense to add 5 to the caption of a label, even though the language the CPU understands would allow it. Therefore, we design and use languages that restrict what
we can do, using less syntax
in the process.
Consider the fancy terminology used by scientists. While it sometimes seems like scientists use really long words to describe simple things, there's actually a lot of meaning imbued in those words. If two people understand fancy terminology in some subject area, they can talk about it in shorter sentences, without losing any meaning. Moreover, by restricting the meaning of some common words to one or two definitions, one can be precise and succinct at the same time. This is what higher level
programming languages achieve: we establish a syntax
that restricts how
things can be said, in a way that allows precision and succinctness without [much] loss in expressive convenience.
Syntax & Grammar
Matters order a word English standard sentence in how consider comprehending. Alternatively: Consider how word order matters in comprehending a standard English sentence.
Rules of grammar restrict how words can be combined into phrases and how phrases can be combined into sentences. Without grammar but with the English vocabulary, there would be too many ways to express any given idea. Long sentences would have a tremendous amount of ambiguity. Therefore, we set forth rules.
Rules for programming languages are much stricter than a standard, "natural" language grammar. These rules are often called "syntax" — "grammar" actually means something slightly different with respect to programming languages. This strictness explains why, upon initial encounter with a compiler that enforces these strict rules, one can identify with the first definition given, above, for compilers