Yes, on a simple microcontroller like the ATTiny the two lines of code are equivalent. The function
pinMode(...) just looks up what pins relate to what ports in a table and set the right registers.
DDRB instead of
pinMode(...) is fine as long as you are never going to run your code on anything else (or give it to anyone else to run), since you have now hard coded into your sketch what pins are to be used. It is more efficient to use
DDRB though. You sacrifice portability for efficiency.
However, for more complex microcontrollers that have many many functions on a single pin, just manipulating
DDRB (or the equivalent on the target microcontroller) may not be enough. You may need to switch the pin into GPIO mode, disable analog inputs on the pin, or other operations as well. All that will be wrapped up in the
pinMode(...) function for you by the Arduino API so you don't need to worry about it.
So, in short, if you don't care about portability, and you do care about efficiency and code size (which may well be the case on an ATTiny) then yes use
DDRB and its friends.