Steel grating is a fabricated product, it has manufacturing tolerances on size. The gap is to make sure the grating will fit even if it is slightly larger (but within allowable manufacturing tolerance) than the nominal size.
Also, the supporting structure has construction tolerances that could result in a smaller gap than expected.
As time goes by, grating often has to be removed for various reasons. The gap makes sure that the grating does not get wedged into place by normal small movement of the supporting structure.