1. This is the desk. That belongs to Bill.

= This is the desk that belongs to Bill.

2. This is the window. Bill broke it yesterday.
= This is the window that Bill broke yesterday.

3. This is the book. Its cover is red.
= This is the book whose cover is red.

4. This is the book. The cover of it is red.
= This is the book the cover of which is red.
= This is the book of which the cover is red.

(Are they all grammatical? Are there any wrong expressions?)

4, for the first one seems iffy. You might wanna use a comma after book.

=This is the book, the cover of which is red.

If you get so desperate just type your sentences in to microsoft word and spell check

The first three sentences are correct.

For number 4, it would be better to say

This is the red book.

Or

This is the book with the red cover.

Yes, all of the sentences are grammatically correct. However, there are more natural alternatives for a couple of them.

1. This is the desk that belongs to Bill. (Correct)
OR
This is Bill's desk.

2. This is the window that Bill broke yesterday. (Correct)

3. This is the book whose cover is red. (Correct)

4. This is the book the cover of which is red. (Correct)
OR
This is the book whose cover is red.

In sentence 1, instead of saying "This is the desk that belongs to Bill," you could simply say "This is Bill's desk" for a more natural expression.

In sentence 4, instead of saying "This is the book the cover of which is red," you could also say "This is the book whose cover is red."

Overall, all of the expressions are grammatically correct, but there are variations that may sound more natural in certain contexts.