It's just a clever use of the palette and some dithering to create the illusion of more colours. The GBA version's inspiration helped a lot with paying a close attention to the colours.