The signature of a merging pair of black holes is a "chirp" - both the amplitude and the frequency of the waves increase as the black holes spiral closer together before ultimately merging.
The amplitude of the detected signal depends on the mass of the black holes, how rapidly they are orbiting and how far away they are. The frequency of the waves is twice the orbital frequency - so at any point in time this parameter is known (in practice all these things are derived by fitting a complete model to the whole signal).
But the power emitted by gravitational waves depends on the mass of the black holes and their orbital period, and this determines the rate at which the black holes spiral together and thus determines the rate at which the frequency changes (the chirpiness of the chirp!) and is independent of the distance.
There are therefore effectively three observational constraints, - the amplitude of the signal, the frequency of the signal and the rate of change of the frequency of the signal (all of which evolve with time). These can be solved to give the black hole masses, and the distance to the black hole system. This analysis is most sensitive to the total mass of the system and only weakly dependent on the mass ratio of the individual black holes.
In practice what is actually done is that a library of pre-calculated models for different black hole masses are scaled according to different distances and compared with the observed waveform until the best match is found. There are additional subtle effects on the waveforms that do depend on the ratio of the individual black hole masses, their individual spins and the "viewing angle" for the binary, but these are only weakly constrained by the data.
The details can be found in Abbott et al. (2016).
Once the distance is estimated, or more precisely - the "luminosity-distance", this can be translated into a light-travel time because gravitational waves move at the speed of light. This is the origin of the ages for this event you will have seen.