Spectra of ultracold neutrons that appeared in experiments on neutron diffraction by a moving grating were measured using the time-of-flight Fourier spectrometer. Diffraction lines of five orders were observed simultaneously. The obtained data are in good agreement with the theoretical predictions based on the multiwave dynamical theory of neutron diffraction by a moving grating.