You adjust the timing window. If the display adds 20ms of lag, you expect the player to press 20ms later.
This wouldn't work for most games, because in, say, Mario Kart, the world needs to immediately react to the player's input. But in a Rhythm game, no one will notice if the visual feedback comes in a few ms late, as long as inputs are being read at the perceived-correct time. (Delayed audio feedback may be slightly noticeable in particularly bad cases, hence my note about key-sounded games.)
N.B.
1. This doesn't make the timing window more forgiving. Presses made at +0ms are counted as too early, because it is too early on the player's display.
2. I say "display" for simplicity, but IRL it's often a mistake to assume that audio and the display are delayed by equal amounts.
-----
Edit: To be clear, you can't fix this—the developer has to add user-adjustable latency settings. PS2 games designed for zero-latency CRTs and will never work properly on laggy LCD screens.
New games, however, usually let you adjust for latency. Although, they often make the mistake of not accounting for audio latency, or not allowing visuals and audio to be adjusted separately.
Btw, I've heard that the newer Rockband games in particular can auto calibrate for latency via hardware built into the peripherals.