Oh, it hasn't really got anything to do with conforming to xml, or a dtd.
Your first example (<% %>) is called a scriptlet tag - here you can embed Java code to be compiled by the container (eg Tomcat). Some people say you shouldn't use scriptlets as they should be in their own classes, some don't.
The second "xml syntax" (standard tag library)(<jsp:useBean .../>) is another way of using Java components, but in a more "html coder /scripter friendly way" - and it is the *desired* form for some.
To be honest, there are times when using scriptlets makes sense, and times when they don't. For example, you don't want to connect to a databse using scriptlet tags, but you may want to control the colours of an html <table> rows using a simple scriptlet loop.
In my experience, you should aim to go for the second tag library option, unless it means going to extraordinary lengths to do something that could be done in 2 minutes in a scriptlet.
Hope this clears it up ...