You can use a filtered
/clone command that will copy blocks to their same position. The result is no difference visually, but the command can return a CommandStat value depending on its success.
Objective to hold the returned CommandStat value.
/scoreboard objectives add BLOCKS dummy
AffectedBlocks trigger to players, so that when they run commands, their own "BLOCKS" score will be set equal to the number of blocks affected. You may need this on a clock if new players can join at any time.
/stats entity @a set AffectedBlocks @a[c=1] BLOCKS
In order for CommandStats to modify a target's score, they must be tracked on the scoreboard prior. This may need to be on a clock as well.
/scoreboard players add @a BLOCKS 0
The following must be run in order on a clock.
Cause players to run a
/clone command around them, looking for grass specifically. It will be cloned to the same position that they're already in. This will return either the number of grass blocks found or 0. The target coordinates should be the same as the first specified corner.
/execute @a ~ ~ ~ /clone ~-10 ~-1 ~-10 ~10 ~10 ~10 ~-10 ~-1 ~-10 filtered force minecraft:grass
Players with a "BLOCKS" score of 1+ has grass around them. You can target them based on this value.
/say @a[score_BLOCKS_min=1] has grass blocks around them.
/say @a[score_BLOCKS_min=10] has at least 10 grass blocks around them.