Gravity affects weight because gravity creates weight. Objects have mass, which is defined as how much matter an object contains. Weight is defined as the pull of gravity on mass.
The relation between weight and gravitational pull is such that, when on another celestial body, the difference in gravity would alter a person's weight. The Earth's moon, for example, has a gravitational field that is 0.165 times the pull on earth. A person who weighs 170 pounds on Earth would only weigh 28.05 pounds on the moon. This is why during the moon landing videos, people on earth viewed the astronauts taking large, bounding steps. With very little weight, it was easy for them to push off the ground.