It's not just about power, though (might want to compare torque numbers, since horsepower is for the high end stuff, and torque has to do with the off the line stuff).
The M3 handles better, is a bit sharper looking (although I'm not saying the G35 is ugly by any means). I DO dig the throaty growl that the G35 has, but having personally looked at both, and test drove both (when I was shopping for my 760Li, just to entertain the option of going that direction, instead of the sedan), the M3 is better overall (plus, the BMW maintenance being paid for sure doesn't hurt, either).
M3 - 333bhp/7900RPM 262lb/ft/4900RPM
G35 - 298bhp/4800RPM 260lb/ft/4800RPM (this is the 6SMT)
M5 - 500bhp 383lb/ft (estimated)