How do colleges take into account difficulty and competitiveness at a high school?

I don’t know much about the admission process and I was just wondering how colleges evaluate and compare your GPA when schools are so different in difficulty, curriculum, teachers, etc. One of my friends in another school has a way higher GPA than me even though (I’m not trying to be arrogant) I am smarter. My school is a lot more difficult and competitive, but it doesn’t rank. How will colleges accurately compare GPAs at different schools?

High schools submit reports which allow colleges to see past the hard GPAs. They are keenly aware that one school’s 3.9 does not automatically equate to another school’s 3.9 GPA. The reports include % of poverty-level kids, % of kids who graduate the HS in four years, % of kids going to 4 yr colleges, outline of top level coursework, even the GPA ceilings of the topmost students.

Logical, no?

@T26E4 is correct, and colleges can also use ACT/SAT to standardize academic potential.