Sunlight and gravity are not considered matter because sunlight does not have a rest mass that is characteristic of matter while gravity is just a vector component of matter.
Step-by-step explanation:
Sunlight has energy and momentum that makes it similar to matter but it cannot be considered matter when you consider all the factors that are characteristic of matter. Light is an electromagnetic wave that is made up of photons and the protons do not have rest mass.
Gravity is a vector component of matter that has both magnitude as well as direction and the gravity increases with increase in mass of an object.