Does increasing the framerate while not changing the content affects compression quality?
This depends on the specific encoder, and the compression standard, by itself, may not have anything to say about it.

x264, which encodes to H.264, takes frame duration, into account, in its ratecontrol algorithm.

From the source code (my emphasis):


  Ratecontrol lowers relative quality at higher
  framerates and the reverse at lower framerates; this serves as
  the center of the curve.


where this refers to the frame duration for the default fps of 25.

This is further compounded by the setting of buffer sizes, important for network streaming or hardware players, and which are defined in terms of media duration, not frame count.