Short answer:
You have to remember, grouping is simply splitting the middle term so that it can be grouped:
Take the expression $ 3x^2+10x+8 $
The terms have no common factors, but if you just split the middle term right:
$$3x^2+4x+6x+8$$
You can suddenly "group" the expression like such:
$$x(3x+4)+2(3x+4)$$
Woah - Magic! Now we have $(x+2)(3x+4)$!
Long answer:
Continuing off Gerry Myerson's answer:
Given the expression:
$ ax^2+bx+c $
You could rewrite it as such:
$(dx+e)(fx+g)$
Which proves the following is true (multiply it out):
$$ ax^2+bx+c=dfx^2+(dg+ef)x+eg $$
What you want to do first is to find $dg$ and $ef$. Since you already know that $df = a$, and $eg =c$, all you have to do is factor $dfeg$, or $ac$, into $dg$ and $ef$ (remember, $dg+ef=b$). Once you have found $dg$ and $ef$, you can rewrite the expression as such:
$$dfx^2+dgx+efx+eg $$
Now, you can "group" the equation into two factorable terms like so:
$$dfx^2+dgx = dx(fx+g)$$$$ efx+eg=e(fx+g)$$
Yay! Now your expression is simply:
$$dx(fx+g)+e(fx+g)$$$$=(dx+e)(fx+g)$$