For the yellow beam, you need 8 stars or higher. The green beam is 10 stars, and the red beam is anything below 8. So if you wanted to downgrade from green to yellow, you'd simply have to do a playthrough where you got less than 10 stars, but at least 8 or higher. Hope this helped.

It's also worth noting that using any bonus weapons automatically lowers your grade, so keep that in mind.