Could it be possible that a virus rewrites my BIOS with some malicious code? If so, how could I protect against it, or at least how can I check that the BIOS hasn't been modified?
It is certainly possible. See this presentation for example: http://www.coresecurity.com/files/attachments/Persistent_BIOS_Infection_CanSecWest09.pdf
One way to achieve protection is by requiring a flash bios password that some implementations support.
Another way is by using a TPM which does almost exactly what you are suggesting: It creates a SHA-1 hash of the BIOS image before loading it - and if Secure Boot is enabled it compares it to a stored value.
Now, how to check if the BIOS is compromised:
The general idea is that you can take a BIOS backup image at any time and compare the hash of that image to the hash of a previous one - maybe one you took after flashing.
But, in theory, if the BIOS modification is malicious enough, it will serve you something that won't be suspicious - so you won't actually be able to check but only just re-flash (and this may not be enough if the flash procedure itself uses bios functions that are hooked). Generally to check the integrity of anything, you have to perform the checking operation at a level lower that the level of the object you check. With BIOS this is pretty hard - and this is one of the reasons TPMs were invented.
Intel CHIPSEC can dump your ROM. Then, you can use CHIPSEC, UEFITool, UEFI Firmware Parser, and some other tools to examine your ROM. If you saved a copy of your ROM when you first got the box, you can start diffing the ROM dumps for changes, to look for malware. Look at how Intel ATR's research on Hacking Team UEFI malware as an example. Look at CHIPSEC's PDF spec for example usage as well. http://firmwaresecurity.com/2015/07/15/intel-analysis-of-hacking-team-uefi-malware/ Other tools mentioned above listed here: http://firmwaresecurity.com/2015/07/27/index-to-tool-review-blogs/