As others have noted, this is part of the C and C++ language standards. In the C99 standard, it is covered in section 5.1.1.2 (translation phases):
Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. If, as a result, a character sequence that matches the syntax of a universal character name is produced, the behavior is undefined. Only the last backslash on any physical source line shall be eligible for being part of such a splice. A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place.