They are just numbers allocated by Windows when it sees a serial port. The numbers themselves have no meaning, they are just to identify which port is to be used. The hardware allocated the number may be different from one port to another, for example, one may be a USB serial port and another may be RS232.
Note however that from a programming perspective the required path string when opening them as a character device is slightly different IIRC, MSDN will have the details.