A method for functional patterning of facets of a nonlinear crystal using focused ion beam milling has been developed. The near-field diffraction on periodic gratings has been experimentally and theoretically studied. The periodicity of the structure enables Talbot self-imaging at the fundamental and second-harmonic frequencies simultaneously. Spatial interference patterns for both harmonic frequencies are individual ones, which can enable the higher-accuracy optical testing, coupling the radiation at both frequencies, and wavelength-division demultiplexing. The impact of the aperture effect on a Talbot carpet is discussed.