There is irony in Winston's writing in his diary. There is little doubt that he wrote even one word in the book without someone knowing about it; although this is not known to us when the book starts, we soon realize it must be true.
In terms of the structure of the novel, Orwell uses the diary to involve us in the plot (he does this with another book later in the book when he needs/wishes to convey information [lecture us] about the Emmanuel Goldstein text). The diary also functions to engage us in Winston's character. We know that he is not just "another" party member, that he is up to something that we want to know more about. At the very beginning of the book it gives us some hope that we have here a man whose life may be important; once we learn more about their society, we know that it seals his doom.
The diary is a symbol for Winston's desire to be free. He is unable to speak his mind, think his true thoughts, or do anything that may mark him as a suspicious character. Even his facial expressions can give him away...he must be in complete control of himself all the time. In the diary, he can write what he is thinking and feeling without the fear of being turned in by someone nearby. Of course, there is always the possibility that the diary will be discovered, but as long as he writes in it where the telescreen can not see him and he keeps it hidden, he can be relatively certain that his thoughts are safe.
It is not until his actions with Julia in the hidden apartment are discovered that the Thought Police search his home and also discover the diary which helps to incriminate Winston.
The diary is a symbol of the freedom he desires. It represents a time when all people, like the Proles, were able to think and express those thoughts freely.
The diary serves as an object for us to get interested, to get interested, as we are unsure as to why writing a diary is wrong in the society in the book.