See that you have to do the code using a special pattern. UP (wait), UP, DOWN (wait), DOWN, UP (wait), UP (wait), UP (wait), UP.
Since the Genesis controler can't press UP-DOWN at the same time, you will understand that you have to succeed pressing UP and one fame and DOWN at the next frame with no interruption!
(wait) simply means you must have at least 1 frame of interruption between button presses.
Sonic 3 was made in Japan on 50 Hz PAL so I guess it's extreamly hard on NTSC 60 Hz. However, it is possible to do the code. I did this code with NTSC 60 Hz enabled in Gens. I succeed most of the times. I got the pattern from testing frames and key presses with a debugger, so this is the only way, and it works.