Periodical spatial modulation of the excitonic resonance in a quantum well could lead to the formation of a new highly directional and resonant coherent optical response -resonant diffraction. Such excitonic diffraction gratings were demonstrated in epitaxially grown quantum wells patterned by the low-dose ion beam irradiation before or after the growth. In this paper we present a theoretical model of the resonant diffraction formation based on the step-by-step approximation of the Maxwell equation solution. The resulting theory allows us to reliably describe experimental data, as well as to predict the way to increase the diffraction efficiency.