When I work on the replay format, I usually fire up a hex editor and
stare at the bytes for a few minutes/hours/days. In this sense, it's
much like solving an integral :) I just stare at it and try to
recognize patterns and then assign meaning to them.
There is no reason to start from scratch, though, as there is already
some nice documentation lying around the interwebz. One of these gems
is courtesy of the sc2reader project:
https://github.com/GraylinKim/sc2reader/wiki (you might also want to
check out their code, that is a much more structured approach to
replay parsing). For phpsc2replay, much of our documentation is out of
date; our reference is usually the code itself.
There are other projects that analyze replays, most notably there is
sc2gears, which unfortunately is written in java and is not open
source.
Good luck,
Zsol