An extension of the dual weighted residual (DWR) method to the analysis of electromagnetic waves in a periodic diffraction grating is presented. Using the α,0-quasi-periodic transformation, an upper bound for the a posteriori error estimate is derived. This is then used to solve adaptively the associated Helmholtz problem. The goal is to achieve an acceptable accuracy in the computed diffraction efficiency while keeping the computational mesh relatively coarse. Numerical results are presented to illustrate the advantage of using DWR over the global a posteriori error estimate approach. The application of the method in biomimetic, to address the complex diffraction geometry of the Morpho butterfly wing is also discussed.