How does Newton's second law relate to the force of gravity?
Gravity is the force between masses. F=ma, so the acceleration of a mass due to gravity will be different on different masses (planets).
The acceleration of an object as produced by a net force is directly proportional to the magnitude of the net force, in the same direction as the net force, and inversely proportional to the mass of the object.
Without needing to know exactly how gravity exists we know that it is a FORCE proportional to an object's mass, whether a star, a planet, a moon or a pencil. It is this proportionality that makes things seem "lighter" on the moon, and "heavier" on Jupiter.
The inherent mass of an object doesn't change, but the acceleration felt due to gravity (weight) is dependent on the mass of the attracting body. This 'felt-force' is mutual. The sun is 'attracted' to the earth gravitationally just as the earth feels a gravitational force from the sun.