Ballpark factor, at its most basic, takes the runs scored by Team X (and its competitors) in Team X's home ballpark and divides the figure by the runs scored by Team X and its competitors in Team X's road contests. Often times, that number will be ever-so-slightly adjusted if a team doesn't play the same opponents at home as on the road.
For example: In 2018, 849 runs were scored at Coors Field, and 676 runs were scored in Rockies games away from Coors Field. Coors Field had a park factor of 1.271, when looking at runs scored.
The same exercise can be done with other stats, such as home runs, triples, doubles, etc.
Why it's useful
Park factor is a great way of determining the extent to which a stadium favors hitters or pitchers. It isn't affected by the teams or players involved, because those teams and players are also playing games in other stadiums. It simply compares how easy it is to score, from one ballpark to another.