Well, strictly speaking, absolutely no modifications to the router circuitry or RF sections is legal according to the FCC Part 15 rules-n-regs. About all you can legally do is replace the antenna, but only with one of either the same type with equal or lesser gain, or one that the manufacturer has bothered to type certify. So much for the legal angle.
More interesting is what happens when you crank up the power output. I haven't run any tests with a WRT54G to see what the spectra looks like at various power levels. There was a page where someone posted some really horrible (no graticule) spectrum analyzer photos, but I can't find it again. As I recall, the spectra stayed fairly reasonable up to about 80mw (+20dBm). Any more and the spectra looked awful and possibly/probably/maybe cause problems.
Incidentally, I prefer to solve coverage problems with antennas rather than boosting the transmit power, but I recognize that it's difficult to resist the temptation to use maximum power if available.
I can give you an example. I have the same router. I bought it a couple of months ago after destroying my WRT54g Ver. 1 (or was it 1.1?). I tried to put the DD-WRT firmware on it and found that I should have read the instructions more than once :) To keep a long story short, while trying to short across the 2 pins needed to "debrick" the thing I accidently shorted a diode nearby on the circuit board. I picked up the ver. 4 at Best Buy and flashed it with the correct DD-WRT and boosted my power up to 60mw. I had some dead spots before the power boost and now those zones can connect fine. Maybe someone can step in here and clarify how much of a boost is safe and legal. I'm really not sure.