Yes, the PlayStation 3 guitar controller from Guitar Hero 3 does work with Guitar Hero 2. The instruments are largely cross-compatible within the series, so you can use the newer peripheral with the earlier game.
This backward compatibility is handy if you own both titles and would rather not keep multiple controllers around. Just connect the PS3 guitar and you should be ready to rock out to the Guitar Hero 2 setlist without any trouble.