In this case, it's not the newline that defines this behavior. Try it without the newline... it should work just fine. It's been a while since I've looked at the parser, but that's where you would find your answer. There is no formal grammar.
If I remember correctly, this works because, unlike Ruby, Julia is able to determine what defines a complete expression before resolving symbols. So 'if' simply looks for the first complete expression to use as it's condition, and everything following that is the body. As a little quirk, since unused symbols in void contexts aren't resolved, the if-then-else-end syntax actually works! https://github.com/JuliaLang/julia/issues/6846
