Guitar Hero 2, like Guitar Hero 1, uses a star rating system to give the player an idea of how well they performed each song. The star rating system is largely based on the numerical score for each song.
You can get 3 stars, 4 stars or 5 stars, depending on your numerical score. These usually look like they were sketched in pencil. Usually. Imagine a player's surprise when one day there are 5 gold stars instead! These gold stars look like the little gold stickers you used to get (or maybe not) on some of your schoolwork back in school.
How to get them? Simply hit every note in the song, and your stars will be shown in gold. It doesn't matter how long you hold the note for, so if you let go early on some of the long notes you'll still be okay, so long as you hit them all.
You will also get the gold stars even if you strum inbetween notes, breaking your streak. Again, so long as you hit all the notes you will get the gold stars.
It is even possible to get 3 gold stars or 4 gold stars in Guitar Hero 2, by getting lower scores while still hitting all the notes, though you probably have to do this on purpose.
Here's how to get 3 gold stars, just so you can prove to yourself that it's possible. Pick a Guitar Hero 2 song on easy. Any song you want. As you play through, make sure you hit all the notes, but don't hold the long sustained notes. Also, and this is important, after every few notes you hit, just strum your guitar controller where there is no note, so you won't spend a lot of time (if any) with the x2, x3 or x4 multiplier. These will give you a high score, and you'll end up with 5 gold stars instead of 3 if you let those points add up.
Summary: Hit every note and get gold stars.