I've quickly edited Rojohound's terrain gen capx to show how you can turn top sprites to grass.
[attachment=0:2gf8vq9q][/attachment:2gf8vq9q]
After generating the terrain press spacebar.
To check surrounding tiles you'll need to loop through the array. I checked for the current cell value being "1" which is a solid then to check surrounding tiles I used CurX (this stays as it is because we're not interested in left&right surroundings) and then CurY-1 which will check "1" cell above the current cell is "0" which is air.
If you planning on doing more like this you WILL be using bitwise numbers eventually since that has nothing to do with the fact that your terrain gen is array based it is a method of setting tiles/sprites based on surroundings.
There is another example of mine
HERE
and a link to my blog post about using bitwise numbers for tiling levels.