g(x)=|f(x)| is only an ordinary function from R^n to R. So grad(g) = ( g_1, g_2, ..., g_n), where g_i is the i-th partial derivative.

For your case, f is actually a map from R^n to R^2, g=\sqrt<f,f>. Then you can do the differential via chain rule and the Leibniz rule that D<f1,f2> = <Df1, f2> + <f1, Df2>. <,> is the inner product of R^2.