This is addressed in section 4.1 "Speed of Gravity" of one of the GW170817 companion papers: Gravitational Waves and Gamma-Rays from a Binary Neutron Star Merger: GW170817 and GRB 170817A. General relativity predicts that GWs travel at the speed of light. The difference in time of arrival could come from a difference in speed or a difference in the time of emission, i.e. the gamma rays are emitted after the merger.
Under conservative assumptions described in the paper the fractional difference in the speed of light and the speed of gravity is bounded as:
$$-3\times 10^{-15} \le \frac{v_\mathrm{GW}-c}{c} \le +7\times 10^{-16}$$
I think this is the strongest bound on the speed of gravity to date.
They also discuss dispersion through the intergalactic medium. The speed of light in a medium depends on the frequency of the light, with low frequencies traveling slower than high frequencies. Gamma-rays have very high frequencies and should not be slowed very much
The intergalactic medium dispersion has negligible impact on the gamma-ray photon speed, with an expected propagation delay many orders of magnitude smaller than our errors on ${v}_{\mathrm{GW}}$.
To answer your question 3, the delay is measured as the time from the merger of the two neutron stars to the start of the gamma-ray burst. The gravitational waves are emitted during the inspiral phase of the binary evolution too. They are detectable for about 100 s before the merger.
During the merger, the material at the core of the event will be very dense. Even gamma rays won't be able to propagate through it. To answer question 2, the gamma rays that were observed are probably generated slightly after the merger, outside of the newly formed single body.