The dirt block receiving grass must be within a 3×3×5 range of the source grass block where the source block is in the center of the second topmost layer of that range.
Grass spreading without player intervention depends heavily on the time of day. For a dirt block to accept grass from a nearby grass block, the following requirements must be met: Grass can spread to nearby dirt blocks, but not coarse dirt. Grass blocks generate naturally in most biomes in the Overworld and as part of villages. For more information, see Breaking § Speed.