When referring to a programming language, syntax is a set of rules for grammar and spelling. In other words, it means using character structures that a computer can interpret. For example, if a user tries to execute a command without proper syntax, it generates syntax error, usually causing the program to fail.
In a text editor that supports syntax highlighting, all of the programming language's syntax elements (e.g. a command like if) are highlighted with different colors to make it easier to read the code.