Hi,
It is the equations of motion that are invariant under the addition of a function that is the total time derivative of some function, to the Lagrangian. Since the Euler-Lagrange equations involve derivatives with respect to position and velocity only, a partial derivative wrt to position or velocity of this added function will be zero.
Hope this helps
Ray