What are good books for learning grammar ( BNF )?
For just learning about BNF grammars, a good reference is this.

However, since you mentioned its with the interest of developing a compiler, the dragon book is probably the best reference possible.