Bitcoin Core's releases are built using a deterministic build process. This means that given a specific set of source code, compiling it with the deterministic build system will always result in identical binaries (and thus identical hashes). If the code you compile is different, then you will get a different binary (and thus different hashes). You can perform a deterministic build yourself and compare the result against the binaries uploaded to bitcoincore.org. All you have to do is setup gitian and follow the instructions.
When releases are done, multiple developers perform gitian builds and check that their results match. If there is a mismatch, the release won't go through as we try to figure out why there was a mismatch. Everyone who participates in this build process uploads their hashes and a PGP signature of those hashes to https://github.com/bitcoin-core/gitian.sigs