Basically, a resource is scholarly if it is written for the purpose of setting out a scholar’s ideas and presenting them to an audience of that scholar’s peers. It is not meant for general audiences, but is instead meant for an audience of professional scholars. The issue, then, is how you tell if a book or an article fits that description.
With respect to articles, the best way to tell is if they are published in peer-reviewed journals. When a journal of this sort receives an article, it sends the article out to reputable scholars. They review it to see if it is worthy of being in the journal. This helps to ensure that only solid, accurate work is published. You can typically tell if a journal is peer-reviewed by looking in its masthead for a statement to that effect.
It is a little more difficult to tell if a book is scholarly. A scholarly book should have a lot of references to show where its ideas came from. It will typically be published by a university press or by one of a handful of other publishers that specialize in serious academic work.
These are some typical ways to be able to tell whether a resource is scholarly.