Generally speaking, one of the main differences between a sorta-identical comparator and opamp is that the opamp usually is internally compensated so it does not break into oscillation in low or unity gain circuits. The compensation is done with a capacitor in shat is effectively a single-pole lowpass filter. This limits the available gain at high frequencies and slows down the slew rate.
OTOH, speed and propagation delay are a big deal in comparator circuits, and they usually run wide open with little or no negative feedback, so there is no compensation capacitor in a chip that is grown specifically to be a comparator.
At high frequencies, an opamp's slew rate limit can straighten out the curves in a high frequency sine wave where the maximum rate-of-change (near the zero-crossings) is greater than the opamp's max. slew rate. When this happens, the output resembles a triangle wave with rounded tops that are the upper portions of the original sine shape, and has a peak value that is less than that of the intended sine wave. This is the case in the second image. The frequency is much higher than the first, and the amplitude is much less.
As the frequency increases, more and more of the sine shape is straightened out and the resulting amplitude continues to decrease. Eventually, with a high enough frequency (relative to the opamp's capabilities), the wave shape is an asymmetrical triangle wave.
All of this applies to a square wave. As the risetime exceeds the opamp's slew rate, the edges begin to slant. At a high enough frequency, the rising edges are so slow that they do not reach the top of the waveform before falling. At this point, again you get an asymmetrical triangle wave as in the second image.
Lowpass: If you look at almost any opamp datasheet, you will find a chart of open loop gain versus frequency. For most general purpose opamps, the curve is flat to around only 10 Hz, then decreases at 6 dB per octave (20 dB per decade). This is the result of the internal compensation, often done with a "Miller capacitor", a form of integrator developed by John Miller in 1920. The capacitor reduces high frequency gain and introduces a phase shift in the signal to increase the phase margin at the output.