If one applies a force to a body then one has to consider the following points: First of all one has to define the generalized forces vector. Moreover, one has to compute the partial derivative of the generalized force vector with respect to the generalized coordinates. This step is necessary for the Jacobian matrix of the entire system.
In general one may apply two different forces to a body. The first one is a space fixed force. This force is often also denoted as dead force and does not rotate with the body. The second type of force is a body fixed force. This force rotates with the body.
The gravitational force is a special case of the space fixed force, where the application point of the force is the center of mass of the body.