From the Super Mario Wiki
Gems are found in Wario: Master of Disguise. When an enemy is defeated, they leave various gems behind (as well as hearts). The gems help Wario level up and have more energy on one of his seven different disguises he gets in the game. Goodstyle eats all the gems to help power up Wario.
This is the list of gems in the game and what form they power up: