A grater is a tool used to shave a block of cheese (or any other food) into sprinkles. Grater is a homophone of greater. Greater means better. "Greater of two evils" means the best choice out of two things that are not great options. The joke is playing on the phrase "greater of two evils" except "greater" is replaced with "grater" because the joke is referencing shredding garlic and cheese. 
My wife uses a kitchen implement to shred garlic and parmesan cheese , which I hate . It really is the grater of two evils .