The article of Wikipedia about gamma correction is quite good:
http://en.wikipedia.org/wiki/Gamma_correctionAbout grayscale, well, it is simple: each primary color (red/green/blue) has a different luminosity, so to compute the resulting luminosity, you need to add those components with a different factor (weight) for each of them. Note that with gamma correction, it is a bit more complicated.
To make a gray color, you need to set the same value for red/green/blue, so you set them to the value you just computed before.
The alpha channel is the A in BGRA. It is the opacity of the pixels. When using BlendImage, it is not necessary to compute the "over" operation if pixels are opaque, because drawing opaque pixels is like replacing the pixels. Otherwise it is needed to do alpha blending:
http://en.wikipedia.org/wiki/Alpha_blendingThe BlendImageOver function does the alpha blending.
Note that those functions BlendImage and BlendImageOver are designed to do complex blending modes, like those used when merging layers to get visual effects:
https://www.youtube.com/watch?v=Lewg3iYkln8Otherwise you just need to use the PutImage function which provides basic blending modes with the draw mode parameter (replacing the pixels without blending, drawing with transparency, drawing without gamma correction and xor mode).