The general reasons why headphones and speakers sound different (stereo separation, construction, openness etc) are already covered in the other answers, but for completeness I'll expand upon something Laurence touched upon. He said it could be about "resonances and reflections in the room" and that deserves a closer look.
With speakers you need to realize that you are hearing the room too. You're hearing not just the direct sound from the speakers but all the reflections bouncing around the room. These reflections can sometimes cause problems like standing waves where the dimensions of your room can cause an increase in volume at a certain frequency and the cancellation of a frequency at another. Bass problems are particularly common in small rooms (ex. a bedroom).
So it may be that in your particular room with your particular speakers and positioning, the guitar sounds unnaturally loud or the piano sounds unnaturally soft due to these "room modes" as they are called. Try some different songs where the guitar and piano sit at different frequencies and see if you hear a difference. Also, try listening at a very soft volume and then at a much louder volume. You may notice that at softer volumes such problems with bass frequencies are less apparent (but so is the bass in general).
This is a very common problem when mixing and it's why you see studios using acoustic treatment on the walls. If the person mixing isn't hearing the correct volume for a particular frequency range they may compensate by boosting or cutting something. This creates a mix that may sound as intended in the engineer's room but has problems on other systems (headphones or not), a.k.a. a mix that doesn't "translate".