I know that WIN32 denotes win32 compilation but what is _WIN32 used for?
WIN32 is a user-defined flag which may be required by some headers. _WIN32 is automatically defined by the visual C/C++ compiler. Since it begins with an _ followed by a capital character, it is reserved by the implementation (meaning the C/C++ toolchain provider).
I prefer to use (read) _WIN32, seems safer to me.