The slope of a line, 'm', is defined as:
m = (y2 - y1) / (x2 - x1)
Now, take a look at that definition closely. The numerator is represents the function's change in the y-direction. The denominator represents the function's change in the x-direction. This is where the idea of "rise over run" comes from. "Rise" correlates to the y-direction, and "run" correlates to the x-direction.
Now consider a horizontal line. It is horizontal, so that means the function does not change (i.e., remains constant) with respect to the y-direction. Mathematically speaking and considering the definition of slope defined above, no change in the y-direction means:
y2 - y1 = 0
If the numerator is zero, then that means the fraction will equal zero, which makes the slope equal to zero.
Hope this helps!