A New Plane‐Wave Formulation for a Layered Medium: Applications to Metagratings | Synapse