What is the purpose of the filtering the image data in the PNG file format
The usage of a word filtering here is somewhat of a misnomer. The filtering operation is typically associated with waveform processing for various applications, as pulse shaping in the transmitter or noise suppression in the receiver. Image filters are also used, but primarily not for better compressibility of image files. In the context of your reference of PNG file format standard, it is possible that this operation would be more aptly named data preprocessing.
A Wikipedia article on PNG file format is more explicit on the compressibility of filtered PNG image data:

An image line filtered in this way is often more compressible than the
raw image line would be, especially if it is similar to the line
above, since the differences from prediction will generally be
clustered around 0, rather than spread over all possible image values.

To further clarify the effect of PNG data filtering on data compressibility, I cite the LZ77 algorithm article:

LZ77 algorithms achieve compression by replacing repeated occurrences
of data with references to a single copy of that data existing earlier
in the uncompressed data stream.

The less variability of &quot;the differences from prediction&quot; that are &quot;clustered around 0&quot;, the more &quot;repeated occurrences of data&quot; exist &quot;in the uncompressed data stream&quot;. Therefore, the more effective is the LZ77 algorithm's work.
The LZ77 is an algorithm the PNG standard uses for compression.
Notice also the statement from  W3C description of the PNG file format:

Filters are applied to bytes, not to pixels, regardless of the bit
depth or colour type of the image.

Again, the Wikipedia article is helpful to better understand this statement w.r.t. compressibility:

An image line filtered in this way is often more compressible than the
raw image line would be, especially if it is similar to the line
above, since the differences from prediction will generally be
clustered around 0, rather than spread over all possible image values.
This is particularly important in relating separate rows, since
DEFLATE has no understanding that an image is a 2D entity, and instead
just sees the image data as a stream of bytes.