Shape resonances in nested diffraction gratings