A grating is any regularly spaced collection of essentially identical, parallel, elongated elements.
A grating covering a drain (as illustrated) can be a collection of iron bars (the identical, elongated elements) held together (to ensure the bars are parallel and regularly spaced) by a lighter iron frame.
The grating profile is the function of the reflectance or transmittance perpendicular to the lines.
A lens will form an image of a sine wave grating that is still sinusoidal, but with some reduction in its contrast depending on the spatial frequency and possibly some change in phase.
Campbell and Robson promoted using sine-wave gratings by arguing that the human visual performs a Fourier analysis on retinal images.