Why do ADS-B traffic targets differ in altitude between ForeFlight and my Garmin unit when using a GDL-39?

ADS-B traffic is broadcast with pressure altitude information associated with it.  ForeFlight compares relative traffic altitude by comparing GPS altitude to the pressure altitude of the ADS-B traffic target.  ForeFlight does not utilize pressure altitude information supplied by the Garmin GDL-39 to determine the relative traffic target altitude when ADS-B Out is not installed in your aircraft.

Garmin products, on the other hand, will utilize the GDL-39 pressure altitude in conjunction with the pressure altitude of a traffic target, as provided in the ADS-B traffic broadcast, to compare relative altitude of traffic.  This accounts for the difference in traffic altitude shown in ForeFlight when compared to a Garmin product.  In simple terms, ForeFlight and Garmin use different altitude data types (GPS vs. Pressure) for traffic comparison when ADS-B Out is not installed and detected.

Of note, with ADS-B Out installed in the aircraft, this is not an issue as your aircraft's actual pressure altitude is extracted from the ADS-B broadcast and used to determine relative altitude by comparing ownship pressure altitude to ADS-B traffic pressure altitude.