Yes, it's grammatically correct. The difference is that it focuses on telling the listener where you see a beautiful tree. Duo's suggested translation above focuses on telling the listener what you see outside. Look right before the verb in the following question and answer pairs:
Mit látsz kint? Egy szép fát látok kint. (What? A beautiful tree.)
as opposed to
Hol látsz egy szép fát? Kint látok egy szép fát. (Where? Outside.)
I wonder why we who are beginners cannot learn words and sentences that deal with real life? Is full of words o firefighters, soldiers and kindergarten teachers doing weird things like flying over the city or between airplanes, etc. I think we need the everyday sentences to get along before we can get on to the unnatural behaviours of these people. I still enjoy learning Hungarian but would be absolutely lost in a shop or asking the way or other normal things.