A Grignard reagent is a
source of a carbanion. The carbon attached to magnesium in a Grignard reagent reacts with carbonyl carbon to form a carbon-carbon bond. This carbon-carbon bond-forming reaction is a way of converting
smaller carbon compounds into
bigger ones.
Grignard reagents react at C=O in
aldehydes and ketones to give
alcohols.
The
alcohol arising from reaction of a
Grignard reagent with an
aldehyde is
secondary. This is because aldehydes have H at the carbon bearing O, and there is also a H at this carbon in the product.
The exception to this is methanal (CH2=O) where primary alcohols are produced. 
The
alcohol arising from reaction of a Grignard reagent with a ketone is tertiary. This is because ketones have no H at the carbon bearing O, and there is no H at this carbon in the product.
Grignard reagents react at
C=O in CO2 to give
carboxylic acids:
CH
3MgBr +
O=C=O 
CH
3CO2H
The red and black colouration for the atoms in the products show which atoms come from the carbonyl compound and which come from the Grignard. When planning a synthesis using a Grignard reagent and a carbonyl compound, it is important to remember that the
new bond will be
formed to the carbon bearing oxygen and to choose the carbonyl and Grignard component accordingly.