Multilayered diffraction gratings are an essential component in many optical devices due to their ability to engineer light. We propose a first-order optimization strategy to maximize diffraction efficiencies of such structures by a fast approximation of the underlying boundary integral equations for polarized electromagnetic fields. A parametric representation of the structure interfaces via trigonometric functions enables the problem to be set as a parametric optimization one while efficiently representing complex structures. Derivatives of the efficiencies with respect to geometrical parameters are computed using shape calculus, allowing a straightforward implementation of gradient descent methods. Examples of the proposed strategy in chirped pulse amplification show its efficacy in designing multilayered gratings to maximize their diffraction efficiency.